﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLT_Public;
using System.Data;

namespace QLT_Data
{
   public  class PhanQuyen_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_tbl_PhanQuyen");
       }
       public int Insert_PhanQuyen(PhanQuyen_Public tenQuyen, PhanQuyen_Public ghiChu)
       {
           int Nparameter = 2;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@TenQuyen";
           value[0] = tenQuyen.TenQuyen;
           name[1] = "@GhiChu";
           value[1] = ghiChu.GhiChu;
           return kn.update("insert_PhanQuyen", name, value, Nparameter);
       }
       public int Update_PhanQuyen(PhanQuyen_Public maPQ, PhanQuyen_Public tenQuyen, PhanQuyen_Public ghiChu)
       {
           int Nparameter = 3;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaPQ";
           value[0] = maPQ.MaPQ;
           name[1] = "@TenQuyen";
           value[1] = tenQuyen.TenQuyen;
           name[2] = "@GhiChu";
           value[2] = ghiChu.GhiChu;
           return kn.update("update_PhanQuyen", name, value, Nparameter);
       }
       public int Delete_PhanQuyen(PhanQuyen_Public maPQ)
       {
           int Nparameter =1;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaPQ";
           value[0] = maPQ.MaPQ;
           return kn.update("delete_PhanQuyen", name, value, Nparameter);
       }
    }
}
